<?php

use Illuminate\Http\Request;

use App\Http\Resources\AreaResource;
use App\Models\Area;
use GuzzleHttp\Client;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//Route::get('/', function () {
//
//    return view('welcome');
//});
//
//Route::get('/test-broadcast', function(){
// return  pinyin('中华有为');
//});
//
//Route::get('/api-area', function(){
//    return AreaResource::collection(Area::with('parentAreaName')->get());
//});
//
//
//Route::group([
//    'namespace'=>'UAdmin',
//    'prefix'=>'uu',
//], function () {
//    Route::resource('area', 'AreaController');
//});
//
//Auth::routes();
//
//Route::get('/home', 'HomeController@index')->name('home');
//
//Route::get('/test', 'HomeController@test')->name('test');

//Route::get('/video2', function(){
//    $client = new Client();
//    $res = $client->request('GET', 'http://47.105.178.12:10810/api/v1/login', [
//        'query' => ['username' => 'admin', 'password'=>md5('admin')]
//    ]);
//    $body = $res->getBody();
//    echo $body;
//    $array= json_decode($body, true);
//    echo now()->addSeconds($array['TokenTimeout']);
//    // Implicitly cast the body to a string and echo it
//    return json_decode($body, true);
//
//});
//
//
//Route::get('/vs', function(){
//    $client = new Client();
//    $res = $client->request('GET', 'http://47.105.178.12:10810/api/v1/startrecord', [
//        'query' => ['token' => 'kRmJdXoWR', 'channel'=>1],
//        
//    ]);
//    $body = $res->getBody();
//    // Implicitly cast the body to a string and echo it
//    echo $body;
//
//});

//Route::get('/un', function(){
//    $client = new Client();
//    $res = $client->request('GET', 'http://app_wx.test:8091/api/deviceinfo', [
//        'query' => [],
//        'headers' => [
//            'Authorization'=> 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcHBfd3gudGVzdDo4MDkxXC9hcGlcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTg2NTczNDM5LCJleHAiOjE1ODY5MzM0MzksIm5iZiI6MTU4NjU3MzQzOSwianRpIjoiT1JRZFBUQUMwNXltY0ltdyIsInN1YiI6MTEsInBydiI6ImYwYWVkMDc4YTVjMDE2NWNhZjkwZGY0NWRiYTcxNWI5YTIwMzJhNTkifQ.7Aq6aZWY_kbB07W9krQSCj56OYZdSybocd_IIWnjyts'
//        ]
//    ]);
//    $body = $res->getBody();
//    // Implicitly cast the body to a string and echo it
//    echo $body;
//
//});

Route::get('/soap', function(){
			$options = array(
			'soap_version'=>SOAP_1_2,
			'exceptions'=>true,
			'trace'=>1,
			'cache_wsdl'=>WSDL_CACHE_NONE
		);
		
        $soap = new \SoapClient('http://222.222.126.240:8001/KFPTService?wsdl');   

		// $ret = $soap->__soapCall('GetPlatformParam', $options);		
  
		$ret = $soap->GetPlatformParam(); 

		dd($ret);
	
});

Route::any('/wechat', 'WeChatController@serve');

Route::get('menu/tree', 'MenuController@tree')->name('menu.tree');

Route::namespace('admin')->group(function () {
	Route::get('menu/tree', 'MenuController@tree')->name('menu.tree');
});

Route::group(['guard' => 'web'], function () {
    Route::get('/we_oauth', 'WeChatController@wecallback');
    Route::post('/gencode', 'WeChatController@genCode');
    Route::get('/jssdk', 'WeChatController@jssdk');
});

//Route::group(['middleware' => ['web', 'wechat.oauth']], function () {
//    Route::get('/user', function () {
//        $user = session('wechat.oauth_user.default'); // 拿到授权用户资料
//
//        dd($user);
//    });
//});